<?php
namespace app\qingadmin\controller;

use app\BaseController;
use think\facade\Db;
use app\common\model\User;


class Base extends BaseController
{
    public function initialize(){
        //echo('我是base父类控制器');
        
    }
    //后台公共删除除
    public function del(){
        $id=input('id');
        $dbname=input('dbname');
        $res=Db::name($dbname)->delete($id);
        if($res){
            return alert('操作成功',$_SERVER['HTTP_REFERER'],6);
        }else{
            return alert('操作失败',$_SERVER['HTTP_REFERER'],6);
        }   
    }
    public function status(){
        $id=input('id');
        $dbname=input('dbname');
        $status=input('status');
        $res=Db::name($dbname)->where('id',$id)->update([
            'status'=>$status
        ]);
        if($res){
            return alert('操作成功',$_SERVER['HTTP_REFERER'],6);
        }else{
            return alert('操作失败',$_SERVER['HTTP_REFERER'],6);
        }   
    }
}
